window.onload=function(){try{var path=im_Pref.getFilePref("defsavepath").path;var folder=document.getElementById("imacros-folder-name");folder.value=path;var filename=document.getElementById('imacros-file-name');if("arguments"in window&&window.arguments.length>0){filename.value=window.arguments[0].filename;}else{filename.value="untitled";}}catch(e){Components.utils.reportError(e);}};function chooseFolder(){var folder=document.getElementById("imacros-folder-name");var defdir=null;try{defdir=im_FIO.openNode(folder.value);}catch(e){defdir=im_Pref.getFilePref("defsavepath");}var dir=im_Dialogs.browseForFolder("",defdir);if(dir){folder.value=dir.path;}};function onAccept(){if("arguments"in window&&window.arguments.length>0){var folder=document.getElementById("imacros-folder-name");try{var dummy=im_FIO.openNode(folder.value);if(!dummy.exists()){window.alert("Directory "+folder.value+" does not exists!");return;}}catch(e){window.alert("Wrong path: "+folder.value);return;}var filename=document.getElementById('imacros-file-name');if(!filename.value){window.alert("File name can not be empty!");return;}var bookmark=document.getElementById('bookmark');window.arguments[0].folder=folder.value;window.arguments[0].filename=filename.value;window.arguments[0].confirm=true;window.arguments[0].bookmark=bookmark.checked;}window.close();}